<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core_1_1" %>
<%@ page language="java" contentType="text/html;" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.huike.stu.domain.Student" %>

<!-- 接收控制器转发来的数据 -->
<jsp:useBean id="list" scope="request" class="java.util.ArrayList"></jsp:useBean>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>学生列表</title>
		<style type="text/css">
			table {
				border: 1px solid black;
				border-collapse: collapse;
				margin: auto;
			}
			td {
				border: 1px solid black;
				text-align: center;
			}
			tr {
				height: 36px;
			}
			a {
				text-decoration: none;
			}
			a:hover {
				color: orange;	
			}
		</style>
	</head>
	<body>
		
		<form name="stuAddForm" action="<%=request.getContextPath() %>/add" method="post">
			<table>
				<tr>
					<td width="40px">序号</td>
					<td width="80px">学号</td>
					<td width="100px">姓名</td>
					<td width="60px">性别</td>
					<td width="60px">年龄</td>
					<td width="200px">专业</td>
					<td width="150px">操作</td>
				</tr>

				<c:choose>
					<c:when test="${empty list}">
						<tr>
							<td colspan="7">暂无查询数据...</td>
						</tr>
					</c:when>
					<c:otherwise>
						<c:forEach items="${list}" var="stu" varStatus="status">
							<tr>
								<td>
									${status.count}
								</td>
								<td>
									${stu.no}
								</td>
								<td>
									${stu.name}
								</td>
								<td>
									${stu.sex}
								</td>
								<td>
									${stu.age}
								</td>
								<td>
									${stu.dept}
								</td>
								<td>
									<a href="view?no=${stu.no}">查看</a>
									<a href="edit?no=${stu.no}">修改</a>
									<a href="disable?no=${stu.no}" onclick="return confirm('确定删除该条纪录吗？')">删除</a>
								</td>
							</tr>
						</c:forEach>
					</c:otherwise>
				</c:choose>




			</table>
		</form>
	</body>
</html>